[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 8    CHANGED: TBrowse error handling
------------------------------------------------------------------------------

      Assigning invalid data to TBrowse and TBColumn
      instance variables would not generate an error in
      Clipper 5.01. Type checking during instance
      variable assignment has been added in Clipper 5.01a
      to trap invalid values and produce a recoverable
      runtime error.

      The problem commonly occurs when assigning a NIL
      value to an instance variable as a result of an
      optional parameter:



      FUNCTION MyBrowse( nTop, nLeft, nBottom, nRight, cHeadSep )

         oBrowse := TBrowseNew( nTop, nLeft, nBottom, nRight )

         // If only four arguments are passed to this
         // function the following line will assign a NIL
         // to headSep, resulting in an error.

         oBrowse:headSep := cHeadSep

      The following example prevents accidentally
      assigning a NIL to a TBrowse instance variable when
      a function accepts optional parameters.

      FUNCTION MyBrowse( nTop, nLeft, nBottom, nRight, cHeadSep )

         oBrowse := TBrowseNew( nTop, nLeft, nBottom, nRight )

         // don't assign a NIL - headSep has a default value.
         IF cHeadSep != NIL
            oBrowse:headSep := cHeadSep
         ENDIF


This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson